package com.example.mall.conf;

import cn.hutool.core.net.NetUtil;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConf implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
    @Override
    public void customize(ConfigurableServletWebServerFactory factory) {
        int usableLocalPort = NetUtil.getUsableLocalPort(5000, 6000);
        factory.setPort(usableLocalPort);
    }
}
